#ifndef __MEBSP_DEVCOM_H
#define __MEBSP_DEVCOM_H 			   
  
#include "at32f403a_407.h"
#include <stdint.h>

#define MB_LED_DEV_MAX_PIXEL_NUM (30)

#define MB_DEVCOM_PACK_MIN_LENGTH (41)

#pragma pack (1)
typedef struct
{
  uint8_t cStartCode;
  uint8_t cLedNumVal;
  
  uint8_t cPwmMode;
  uint16_t wPwmDivVal;
  uint16_t wPwmPeriodVal;
 
  uint8_t  bPwmDelayEnable;
  uint32_t wPwmCurveParam[3];
  uint16_t wPwmStartOffVal[6];

  uint8_t bConstPowerEnable;
  uint16_t wConstPowerCurveParam[3];

  uint16_t  wFanPwmVal;
  uint16_t  wPwmVal[MB_LED_DEV_MAX_PIXEL_NUM*6];
  
}_MB_DEVCOM_PACK_T;
#pragma pack () /*取消指定对齐，恢复缺省对齐*/

typedef union {
	_MB_DEVCOM_PACK_T packet;
	uint8_t buffer[MB_DEVCOM_PACK_MIN_LENGTH+MB_LED_DEV_MAX_PIXEL_NUM*6];
}_MB_DEVCOM_DATA_T;

extern _MB_DEVCOM_DATA_T MB_DevComIn_Data;
extern _MB_DEVCOM_DATA_T MB_DevComOut_Data;

#pragma pack (1)
typedef struct
{
  uint8_t cStartCode;
  uint8_t cLedNumVal;
  uint16_t wParVal[MB_LED_DEV_MAX_PIXEL_NUM*6];
}_MB_DEVCOM_REPPACK_T;
#pragma pack () /*取消指定对齐，恢复缺省对齐*/

typedef union {
	_MB_DEVCOM_REPPACK_T packet;
	uint8_t buffer[2+MB_LED_DEV_MAX_PIXEL_NUM*6];
}_MB_DEVCOM_REPDATA_T;

extern _MB_DEVCOM_REPDATA_T MB_DevComInRep_Data;
extern _MB_DEVCOM_REPDATA_T MB_DevComOutRep_Data;

extern void MeBsp_DevCom_Init(void);
extern void MeBsp_DevCom_Hanl(void);

#endif





























